package karpiel.boguchwal.wojciech.przemek

import karpiel.boguchwal.wojciech.przemek.Ast._
import org.scalatest.FunSuite

class RealCacheTest extends FunSuite {
  test(":(") {
    implicit val c = new RealCache()
    implicit val ctx = Context.Empty.append(Universe(0)).append(Bruijn(0)).append(Bruijn(1)).append(IdType(Bruijn(1), Bruijn(0)))
      .append(UnitType)
    val expr = Bruijn(0)

    val n = expr.normalized
    val i = expr.inferType
    assert(c.cache.contains(Context.Empty.append(UnitType)))
    val expr2 = Bruijn(1)
    val n2 = expr2.normalized
    val i1 = expr2.inferType
    assert(i1 == expr2.inferType(ctx, DummyCache))
    assert(n2 == expr2.normalized(ctx, DummyCache))
    assert(c.cache.contains(Context.Empty.append(Universe(0)).append(Bruijn(0)).append(Bruijn(1)).append(IdType(Bruijn(1), Bruijn(0)))))
  }
}
